/***************************************************************************
 *   Copyright (C) 2009 by maarten,,,   *
 *   maarten@maarten-laptop   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef SCENECAMERA_H
#define SCENECAMERA_H

#include "scenemanager/sceneelement.h"

namespace object{
    class Vertex;
};

namespace scene {

/**
	@author maarten,,, <maarten@maarten-laptop>
*/
class Camera : public SceneElement
{
public:
    Camera();
    Camera(QString name, object::Vertex *position, object::Vertex *direction,
object::Vertex *up, float fovy =0);

    virtual ~Camera();

    inline void setPosition ( object::Vertex* position )
    {
        m_position = position;
    }

    inline object::Vertex* position() const
    {
        return m_position;
    }

    inline void setDirection ( object::Vertex* theValue )
    {
        m_direction = theValue;
    }
    

    inline object::Vertex* direction() const
    {
        return m_direction;
    }

    inline void setUp ( object::Vertex* theValue )
    {
        m_up = theValue;
    }
    

    inline object::Vertex* up() const
    {
        return m_up;
    }
    
    void printElement();

    void setFovy ( float theValue )
    {
        m_fovy = theValue;
    }
    

    float fovy() const
    {
        return m_fovy;
    }

    void computeViewPlane(int w, int h);

    float zDistance() const
    {
        return m_zDistance;
    }
    float top() const
    {
        return m_top;
    }
    float top(float n);

private:
    object::Vertex *m_position;
    object::Vertex *m_direction;
    object::Vertex *m_up;

    float m_fovy;

    float m_zDistance;
    float m_top;

    int m_width;
    int m_height;

    void setViewScreen(int w, int h){m_width = w; m_height = h;}
    
};

}

#endif
